bitkeeper revision 1.319.1.1 (3f0c3b96o9tI7VUO855zQI34KKV7Ew)
authorrac61@labyrinth.cl.cam.ac.uk <rac61@labyrinth.cl.cam.ac.uk>
Wed, 9 Jul 2003 15:58:14 +0000 (15:58 +0000)
committerrac61@labyrinth.cl.cam.ac.uk <rac61@labyrinth.cl.cam.ac.uk>
Wed, 9 Jul 2003 15:58:14 +0000 (15:58 +0000)
Update web interface and its build scripts to work with the new control interface; all domain control stuff has been ported. No VD stuff works yet.

23 files changed:
.rootkeys
BitKeeper/etc/ignore
tools/control/Makefile
tools/control/build-web.xml [new file with mode: 0644]
tools/control/build-xen.xml [deleted file]
tools/control/src/org/xenoserver/control/Command.java
tools/control/src/org/xenoserver/web/RootBean.java [new file with mode: 0644]
tools/control/src/org/xenoserver/web/SystemConfigurationBean.java [new file with mode: 0644]
tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java [deleted file]
tools/control/src/uk/ac/cam/cl/xeno/xenctl/SystemConfigurationBean.java [deleted file]
tools/control/web/tmpl/dom-del.tmpl
tools/control/web/tmpl/dom-delr.tmpl
tools/control/web/tmpl/dom-lis.tmpl
tools/control/web/tmpl/dom-new.tmpl
tools/control/web/tmpl/dom-newr.tmpl
tools/control/web/tmpl/dom-sta.tmpl
tools/control/web/tmpl/dom-star.tmpl
tools/control/web/tmpl/dom-stp.tmpl
tools/control/web/tmpl/dom-stpr.tmpl
tools/control/web/tmpl/dom.tmpl
tools/control/web/tmpl/makefile
tools/control/web/tmpl/newdom.tmpl [deleted file]
tools/control/web/tmpl/xenohead.def

index c3a8b7b20124c73515e4a89bf4b150c3a526702c..8807c6523945c43152f655cb9f86542d8ffbe4cb 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
@@ -9,7 +9,7 @@
 3eb781edFwm_pW9FwnQACIe68viLOw tools/control/Makefile
 3eca6a96a31IwaKtkEa4jmzwTWlm8Q tools/control/README-xenctl
 3eb781fceEYkUi1XHKf2V0KX7si2JA tools/control/build-cmdline.xml
-3ec41f7cWCxQ8pdH8ZWqhhv-38qQ1w tools/control/build-xen.xml
+3ec41f7cWCxQ8pdH8ZWqhhv-38qQ1w tools/control/build-web.xml
 3ec41f7ca6IBXDSe0HVcMPp3PPloOQ tools/control/build.properties
 3ec4ebe0g_MI1VqkbbyNB8gt6m0Adg tools/control/docs/empty_dir
 3eb781fcabCKRogwxJA3-jJKstw9Vg tools/control/domctl.xml
@@ -70,8 +70,8 @@
 3ec41f7dKX9YpwrfH7BZ7BogyWqqLA tools/control/src/org/xenoserver/control/VirtualDiskManager.java
 3ec41f7dUPpYTwYL5QVpRBv6PLKPrg tools/control/src/org/xenoserver/control/XML.java
 3ec41f7d7Try-2zmfnpaALwJjY0GCA tools/control/src/org/xenoserver/control/XMLHelper.java
-3ec41f7dOVZgjP4sQS6vjuBnExdlMQ tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java
-3ec41f7dvPdszb0frNEkMnEdJUBVjA tools/control/src/uk/ac/cam/cl/xeno/xenctl/SystemConfigurationBean.java
+3ec41f7dOVZgjP4sQS6vjuBnExdlMQ tools/control/src/org/xenoserver/web/RootBean.java
+3ec41f7dvPdszb0frNEkMnEdJUBVjA tools/control/src/org/xenoserver/web/SystemConfigurationBean.java
 3ec41f7dO6IuKGGLG4VRUhMDmkTn5g tools/control/web/WEB-INF/web.xml
 3ec41f7dRAPXBA0jQUd1k6MB3xVidg tools/control/web/img/cambridge.gif
 3ec41f7dvxVe1Vb3kVOLZcN5Jra2tQ tools/control/web/img/help.gif
@@ -95,7 +95,6 @@
 3ec41f7eTqbaFqMGU7lJG09vlEt0TQ tools/control/web/tmpl/index.tmpl
 3ec41f7ed6_QZ1mg0vuA9Xu1wu1plw tools/control/web/tmpl/install.pl
 3ec41f7emmAnjM4gsW6JWkqsjfi4Rg tools/control/web/tmpl/makefile
-3ec41f7eGeQD-tCpxZNxNVcnKt6HfA tools/control/web/tmpl/newdom.tmpl
 3ec41f7eoDHD2raa4x6dBINr4QLO3A tools/control/web/tmpl/vd-fv.tmpl
 3ec41f7eawycxV05Ow3LfZtOlHZJPA tools/control/web/tmpl/vd-pa.tmpl
 3ec41f7ef4mVT4vwOEL40MKIzS4EeA tools/control/web/tmpl/vd-par.tmpl
index cf41f0cc4eccd77039fa6f60aee480a3d3b8c786..99e9f548eb6b5216b3c41b086a804b7545a214ed 100644 (file)
@@ -436,3 +436,5 @@ xen/drivers/block/xen_physdisk.c~
 tools/internal/xi_phys_grant.c~
 tools/internal/xi_phys_probe.c~
 tools/internal/xi_phys_revoke.c~
+tools/control/dist-web/**
+tools/control/build-web/**
index b8ac064450c7b9eed6d7bf6850cd887f6f978252..c302e55b06a4f705a77a6c81f3cc0f2c1e1e6e9d 100644 (file)
@@ -1,8 +1,8 @@
-default: cmdline
+default: cmdline web
 
-install: install-cmdline
+install: install-cmdline install-web
 
-clean: clean-cmdline
+clean: clean-cmdline clean-web
 
 
 
@@ -19,17 +19,15 @@ clean-cmdline:
 
 
 
-xenctl: FORCE
-       (cd web/tmpl; make)
-       ant -buildfile build-xen.xml dist
+web: FORCE
+       ant -buildfile build-web.xml dist
 
-install-xenctl: xenctl
-       -ant -buildfile build-xen.xml remove
-       ant -buildfile build-xen.xml install
+install-web: xenctl
+       ant -buildfile build-web.xml remove || true
+       ant -buildfile build-web.xml install
 
-clean-xenctl:
-       (cd web/tmpl; make clean)
-       ant -buildfile build-xen.xml clean
-       rm -f xenctl.jar
+clean-web:
+       ant -buildfile build-web.xml clean
+       rm -f xenctl-web.jar
 
 FORCE:
diff --git a/tools/control/build-web.xml b/tools/control/build-web.xml
new file mode 100644 (file)
index 0000000..1973eef
--- /dev/null
@@ -0,0 +1,511 @@
+<!--
+     General purpose build script for web applications and web services,
+     including enhanced support for deploying directly to a Tomcat 4
+     based server.
+
+     This build script assumes that the source code of your web application
+     is organized into the following subdirectories underneath the source
+     code directory from which you execute the build script:
+
+        docs                 Static documentation files to be copied to
+                             the "docs" subdirectory of your distribution.
+
+        src                  Java source code (and associated resource files)
+                             to be compiled to the "WEB-INF/classes"
+                             subdirectory of your web applicaiton.
+
+        web                  Static HTML, JSP, and other content (such as
+                             image files), including the WEB-INF subdirectory
+                             and its configuration file contents.
+
+     $Id: build.xml.txt,v 1.7 2002/12/28 09:08:58 jfclere Exp $
+-->
+
+
+<!-- A "project" describes a set of targets that may be requested
+     when Ant is executed.  The "default" attribute defines the
+     target which is executed if no specific target is requested,
+     and the "basedir" attribute defines the current working directory
+     from which Ant executes the requested task.  This is normally
+     set to the current working directory.
+-->
+
+<project name="xenctl web interface" default="compile" basedir=".">
+
+
+
+<!-- ===================== Property Definitions =========================== -->
+
+
+<!--
+
+  Each of the following properties are used in the build script.
+  Values for these properties are set by the first place they are
+  defined, from the following list:
+
+  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
+
+  * Definitions from a "build.properties" file in the top level
+    source directory of this application.
+
+  * Definitions from a "build.properties" file in the developer's
+    home directory.
+
+  * Default definitions in this build.xml file.
+
+  You will note below that property values can be composed based on the
+  contents of previously defined properties.  This is a powerful technique
+  that helps you minimize the number of changes required when your development
+  environment is modified.  Note that property composition is allowed within
+  "build.properties" files as well as in the "build.xml" script.
+
+-->
+
+  <property file="build.properties"/>
+  <property file="${user.home}/build.properties"/>
+
+
+<!-- ==================== File and Directory Names ======================== -->
+
+
+<!--
+
+  These properties generally define file and directory names (or paths) that
+  affect where the build process stores its outputs.
+
+  app.name             Base name of this application, used to
+                       construct filenames and directories.
+                       Defaults to "myapp".
+
+  app.path             Context path to which this application should be
+                       deployed (defaults to "/" plus the value of the
+                       "app.name" property).
+
+  app.version          Version number of this iteration of the application.
+
+  build.home           The directory into which the "prepare" and
+                       "compile" targets will generate their output.
+                       Defaults to "build".
+
+  catalina.home        The directory in which you have installed
+                       a binary distribution of Tomcat 4.  This will
+                       be used by the "deploy" target.
+
+  dist.home            The name of the base directory in which
+                       distribution files are created.
+                       Defaults to "dist".
+
+  manager.password     The login password of a user that is assigned the
+                       "manager" role (so that he or she can execute
+                       commands via the "/manager" web application)
+
+  manager.url          The URL of the "/manager" web application on the
+                       Tomcat installation to which we will deploy web
+                       applications and web services.
+
+  manager.username     The login username of a user that is assigned the
+                       "manager" role (so that he or she can execute
+                       commands via the "/manager" web application)
+
+-->
+
+  <property name="app.name"      value="myapp"/>
+  <property name="app.path"      value="/${app.name}"/>
+  <property name="app.version"   value="0.1-dev"/>
+  <property name="build.home"    value="${basedir}/build-web"/>
+  <property name="catalina.home" value="../../../.."/> <!-- UPDATE THIS! -->
+  <property name="dist.home"     value="${basedir}/dist-web"/>
+  <property name="docs.home"     value="${basedir}/docs"/>
+<!--  <property name="manager.url"   value="http://localhost:8080/manager"/> -->
+  <property name="src.home"      value="${basedir}/src"/>
+  <property name="web.home"      value="${basedir}/web"/>
+
+
+<!-- ================== Custom Ant Task Definitions ======================= -->
+
+
+<!--
+
+  These properties define custom tasks for the Ant build tool that interact
+  with the "/manager" web application installed with Tomcat 4.  Before they
+  can be successfully utilized, you must perform the following steps:
+
+  - Copy the file "server/lib/catalina-ant.jar" from your Tomcat 4
+    installation into the "lib" directory of your Ant installation.
+
+  - Create a "build.properties" file in your application's top-level
+    source directory (or your user login home directory) that defines
+    appropriate values for the "manager.password", "manager.url", and
+    "manager.username" properties described above.
+
+  For more information about the Manager web application, and the functionality
+  of these tasks, see <http://localhost:8080/tomcat-docs/manager-howto.html>.
+
+-->
+
+  <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>
+  <taskdef name="list"    classname="org.apache.catalina.ant.ListTask"/>
+  <taskdef name="reload"  classname="org.apache.catalina.ant.ReloadTask"/>
+  <taskdef name="remove"  classname="org.apache.catalina.ant.RemoveTask"/>
+
+
+<!--  ==================== Compilation Control Options ==================== -->
+
+<!--
+
+  These properties control option settings on the Javac compiler when it
+  is invoked using the <javac> task.
+
+  compile.debug        Should compilation include the debug option?
+
+  compile.deprecation  Should compilation include the deprecation option?
+
+  compile.optimize     Should compilation include the optimize option?
+
+-->
+
+  <property name="compile.debug"       value="true"/>
+  <property name="compile.deprecation" value="false"/>
+  <property name="compile.optimize"    value="true"/>
+
+
+
+<!-- ==================== External Dependencies =========================== -->
+
+
+<!--
+
+  Use property values to define the locations of external JAR files on which
+  your application will depend.  In general, these values will be used for
+  two purposes:
+  * Inclusion on the classpath that is passed to the Javac compiler
+  * Being copied into the "/WEB-INF/lib" directory during execution
+    of the "deploy" target.
+
+  Because we will automatically include all of the Java classes that Tomcat 4
+  exposes to web applications, we will not need to explicitly list any of those
+  dependencies.  You only need to worry about external dependencies for JAR
+  files that you are going to include inside your "/WEB-INF/lib" directory.
+
+-->
+
+<!-- Dummy external dependency -->
+<!--
+  <property name="foo.jar"
+           value="/path/to/foo.jar"/>
+-->
+
+
+<!-- ==================== Compilation Classpath =========================== -->
+
+<!--
+
+  Rather than relying on the CLASSPATH environment variable, Ant includes
+  features that makes it easy to dynamically construct the classpath you
+  need for each compilation.  The example below constructs the compile
+  classpath to include the servlet.jar file, as well as the other components
+  that Tomcat makes available to web applications automatically, plus anything
+  that you explicitly added.
+
+-->
+
+  <path id="compile.classpath">
+
+    <!-- Include all JAR files that will be included in /WEB-INF/lib -->
+    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
+<!--
+    <pathelement location="${foo.jar}"/>
+-->
+
+    <!-- Include all elements that Tomcat exposes to applications -->
+    <pathelement location="${catalina.home}/common/classes"/>
+    <fileset dir="${catalina.home}/common/endorsed">
+      <include name="*.jar"/>
+    </fileset>
+    <fileset dir="${catalina.home}/common/lib">
+      <include name="*.jar"/>
+    </fileset>
+    <pathelement location="${catalina.home}/shared/classes"/>
+    <fileset dir="${catalina.home}/shared/lib">
+      <include name="*.jar"/>
+    </fileset>
+
+  </path>
+
+
+
+<!-- ==================== All Target ====================================== -->
+
+<!--
+
+  The "all" target is a shortcut for running the "clean" target followed
+  by the "compile" target, to force a complete recompile.
+
+-->
+
+  <target name="all" depends="clean,compile"
+   description="Clean build and dist directories, then compile"/>
+
+
+
+<!-- ==================== Clean Target ==================================== -->
+
+<!--
+
+  The "clean" target deletes any previous "build" and "dist" directory,
+  so that you can be ensured the application can be built from scratch.
+
+-->
+
+  <target name="clean"
+   description="Delete old build and dist directories">
+    <delete dir="${build.home}"/>
+    <delete dir="${dist.home}"/>
+    <exec executable="make" dir="${web.home}/tmpl"><arg value="clean"/></exec>
+  </target>
+
+
+
+<!-- ==================== Compile Target ================================== -->
+
+<!--
+
+  The "compile" target transforms source files (from your "src" directory)
+  into object files in the appropriate location in the build directory.
+  This example assumes that you will be including your classes in an
+  unpacked directory hierarchy under "/WEB-INF/classes".
+
+-->
+
+  <target name="compile" depends="prepare"
+   description="Compile Java sources">
+
+    <!-- Compile Java classes as necessary -->
+    <mkdir    dir="${build.home}/WEB-INF/classes"/>
+    <javac srcdir="${src.home}"
+          destdir="${build.home}/WEB-INF/classes"
+            debug="${compile.debug}"
+      deprecation="${compile.deprecation}"
+         optimize="${compile.optimize}">
+        <classpath refid="compile.classpath"/>
+        <include name="org/xenoserver/control/**"/>
+        <include name="org/xenoserver/web/**"/>
+    </javac>
+
+    <!-- Copy application resources -->
+    <copy  todir="${build.home}/WEB-INF/classes">
+      <fileset dir="${src.home}" excludes="**/*.java"/>
+    </copy>
+
+  </target>
+
+
+
+<!-- ==================== Dist Target ===================================== -->
+
+
+<!--
+
+  The "dist" target creates a binary distribution of your application
+  in a directory structure ready to be archived in a tar.gz or zip file.
+  Note that this target depends on two others:
+
+  * "compile" so that the entire web application (including external
+    dependencies) will have been assembled
+
+  * "javadoc" so that the application Javadocs will have been created
+
+-->
+
+  <target name="dist" depends="compile"
+   description="Create binary distribution">
+
+    <!-- Copy documentation subdirectories -->
+    <mkdir   dir="${dist.home}/docs"/>
+    <copy    todir="${dist.home}/docs">
+      <fileset dir="${docs.home}"/>
+    </copy>
+
+    <!-- Create application JAR file -->
+    <jar jarfile="${dist.home}/${app.name}-${app.version}.war"
+         basedir="${build.home}"/>
+
+    <!-- Copy additional files to ${dist.home} as necessary -->
+
+  </target>
+
+
+
+<!-- ==================== Install Target ================================== -->
+
+<!--
+
+  The "install" target tells the specified Tomcat 4 installation to dynamically
+  install this web application and make it available for execution.  It does
+  *not* cause the existence of this web application to be remembered across
+  Tomcat restarts; if you restart the server, you will need to re-install all
+  this web application.
+
+  If you have already installed this application, and simply want Tomcat to
+  recognize that you have updated Java classes (or the web.xml file), use the
+  "reload" target instead.
+
+  NOTE:  This target will only succeed if it is run from the same server that
+  Tomcat is running on.
+
+  NOTE:  This is the logical opposite of the "remove" target.
+
+-->
+
+  <target name="install" depends="compile"
+   description="Install application to servlet container">
+
+    <install url="${manager.url}"
+        username="${manager.username}"
+        password="${manager.password}"
+            path="${app.path}"
+             war="file://${build.home}"/>
+
+  </target>
+
+
+<!-- ==================== Javadoc Target ================================== -->
+
+<!--
+
+  The "javadoc" target creates Javadoc API documentation for the Java
+  classes included in your application.  Normally, this is only required
+  when preparing a distribution release, but is available as a separate
+  target in case the developer wants to create Javadocs independently.
+
+-->
+
+  <target name="javadoc" depends="compile"
+   description="Create Javadoc API documentation">
+
+    <mkdir          dir="${dist.home}/docs/api"/>
+    <javadoc sourcepath="${src.home}"
+                destdir="${dist.home}/docs/api"
+           packagenames="*">
+      <classpath refid="compile.classpath"/>
+    </javadoc>
+
+  </target>
+
+
+
+<!-- ====================== List Target =================================== -->
+
+<!--
+
+  The "list" target asks the specified Tomcat 4 installation to list the
+  currently running web applications, either loaded at startup time or
+  installed dynamically.  It is useful to determine whether or not the
+  application you are currently developing has been installed.
+
+-->
+
+  <target name="list"
+   description="List installed applications on servlet container">
+
+    <list    url="${manager.url}"
+        username="${manager.username}"
+        password="${manager.password}"/>
+
+  </target>
+
+
+<!-- ==================== Prepare Target ================================== -->
+
+<!--
+
+  The "prepare" target is used to create the "build" destination directory,
+  and copy the static contents of your web application to it.  If you need
+  to copy static files from external dependencies, you can customize the
+  contents of this task.
+
+  Normally, this task is executed indirectly when needed.
+
+-->
+
+  <target name="prepare">
+
+    <!-- Create build directories as needed -->
+    <mkdir  dir="${build.home}"/>
+    <mkdir  dir="${build.home}/WEB-INF"/>
+    <mkdir  dir="${build.home}/WEB-INF/classes"/>
+
+       <!-- create templates -->
+       <exec executable="make" dir="${web.home}/tmpl"/>
+
+    <!-- Copy static content of this web application -->
+    <copy todir="${build.home}">
+      <fileset dir="${web.home}"/>
+    </copy>
+
+    <!-- Copy external dependencies as required -->
+    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
+    <mkdir  dir="${build.home}/WEB-INF/lib"/>
+<!--
+    <copy todir="${build.home}/WEB-INF/lib" file="${foo.jar}"/>
+-->
+
+    <!-- Copy static files from external dependencies as needed -->
+    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
+
+  </target>
+
+
+<!-- ==================== Reload Target =================================== -->
+
+<!--
+
+  The "reload" target tells the specified Tomcat 4 installation to dynamically
+  reload this web application, to reflect changes in the underlying classes or
+  the "web.xml" deployment descriptor.
+
+-->
+
+  <target name="reload" depends="compile"
+   description="Reload application on servlet container">
+
+    <reload url="${manager.url}"
+       username="${manager.username}"
+       password="${manager.password}"
+           path="${app.path}"/>
+
+  </target>
+
+
+<!-- ==================== Remove Target =================================== -->
+
+<!--
+
+  The "remove" target tells the specified Tomcat 4 installation to dynamically
+  remove this web application from service.
+
+  NOTE:  This is the logical opposite of the "install" target.
+
+-->
+
+  <target name="remove"
+   description="Remove application on servlet container">
+
+    <remove url="${manager.url}"
+       username="${manager.username}"
+       password="${manager.password}"
+           path="${app.path}"/>
+
+  </target>
+
+
+  <target name="help">
+    <echo>all      clean, them compile</echo>
+    <echo>dist     create war file</echo>
+    <echo>install  install application in servlet container</echo>
+    <echo>list     list applications installed in servelet container</echo>
+    <echo>reload   reload application in servlet container</echo>
+    <echo>remove   dynamically remove web application</echo>
+  </target>
+
+</project>
diff --git a/tools/control/build-xen.xml b/tools/control/build-xen.xml
deleted file mode 100644 (file)
index 7f7a9b3..0000000
+++ /dev/null
@@ -1,506 +0,0 @@
-<!--
-     General purpose build script for web applications and web services,
-     including enhanced support for deploying directly to a Tomcat 4
-     based server.
-
-     This build script assumes that the source code of your web application
-     is organized into the following subdirectories underneath the source
-     code directory from which you execute the build script:
-
-        docs                 Static documentation files to be copied to
-                             the "docs" subdirectory of your distribution.
-
-        src                  Java source code (and associated resource files)
-                             to be compiled to the "WEB-INF/classes"
-                             subdirectory of your web applicaiton.
-
-        web                  Static HTML, JSP, and other content (such as
-                             image files), including the WEB-INF subdirectory
-                             and its configuration file contents.
-
-     $Id: build.xml.txt,v 1.7 2002/12/28 09:08:58 jfclere Exp $
--->
-
-
-<!-- A "project" describes a set of targets that may be requested
-     when Ant is executed.  The "default" attribute defines the
-     target which is executed if no specific target is requested,
-     and the "basedir" attribute defines the current working directory
-     from which Ant executes the requested task.  This is normally
-     set to the current working directory.
--->
-
-<project name="My Project" default="compile" basedir=".">
-
-
-
-<!-- ===================== Property Definitions =========================== -->
-
-
-<!--
-
-  Each of the following properties are used in the build script.
-  Values for these properties are set by the first place they are
-  defined, from the following list:
-
-  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
-
-  * Definitions from a "build.properties" file in the top level
-    source directory of this application.
-
-  * Definitions from a "build.properties" file in the developer's
-    home directory.
-
-  * Default definitions in this build.xml file.
-
-  You will note below that property values can be composed based on the
-  contents of previously defined properties.  This is a powerful technique
-  that helps you minimize the number of changes required when your development
-  environment is modified.  Note that property composition is allowed within
-  "build.properties" files as well as in the "build.xml" script.
-
--->
-
-  <property file="build.properties"/>
-  <property file="${user.home}/build.properties"/>
-
-
-<!-- ==================== File and Directory Names ======================== -->
-
-
-<!--
-
-  These properties generally define file and directory names (or paths) that
-  affect where the build process stores its outputs.
-
-  app.name             Base name of this application, used to
-                       construct filenames and directories.
-                       Defaults to "myapp".
-
-  app.path             Context path to which this application should be
-                       deployed (defaults to "/" plus the value of the
-                       "app.name" property).
-
-  app.version          Version number of this iteration of the application.
-
-  build.home           The directory into which the "prepare" and
-                       "compile" targets will generate their output.
-                       Defaults to "build".
-
-  catalina.home        The directory in which you have installed
-                       a binary distribution of Tomcat 4.  This will
-                       be used by the "deploy" target.
-
-  dist.home            The name of the base directory in which
-                       distribution files are created.
-                       Defaults to "dist".
-
-  manager.password     The login password of a user that is assigned the
-                       "manager" role (so that he or she can execute
-                       commands via the "/manager" web application)
-
-  manager.url          The URL of the "/manager" web application on the
-                       Tomcat installation to which we will deploy web
-                       applications and web services.
-
-  manager.username     The login username of a user that is assigned the
-                       "manager" role (so that he or she can execute
-                       commands via the "/manager" web application)
-
--->
-
-  <property name="app.name"      value="myapp"/>
-  <property name="app.path"      value="/${app.name}"/>
-  <property name="app.version"   value="0.1-dev"/>
-  <property name="build.home"    value="${basedir}/build"/>
-  <property name="catalina.home" value="../../../.."/> <!-- UPDATE THIS! -->
-  <property name="dist.home"     value="${basedir}/dist"/>
-  <property name="docs.home"     value="${basedir}/docs"/>
-<!--  <property name="manager.url"   value="http://localhost:8080/manager"/> -->
-  <property name="src.home"      value="${basedir}/src"/>
-  <property name="web.home"      value="${basedir}/web"/>
-
-
-<!-- ================== Custom Ant Task Definitions ======================= -->
-
-
-<!--
-
-  These properties define custom tasks for the Ant build tool that interact
-  with the "/manager" web application installed with Tomcat 4.  Before they
-  can be successfully utilized, you must perform the following steps:
-
-  - Copy the file "server/lib/catalina-ant.jar" from your Tomcat 4
-    installation into the "lib" directory of your Ant installation.
-
-  - Create a "build.properties" file in your application's top-level
-    source directory (or your user login home directory) that defines
-    appropriate values for the "manager.password", "manager.url", and
-    "manager.username" properties described above.
-
-  For more information about the Manager web application, and the functionality
-  of these tasks, see <http://localhost:8080/tomcat-docs/manager-howto.html>.
-
--->
-
-  <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>
-  <taskdef name="list"    classname="org.apache.catalina.ant.ListTask"/>
-  <taskdef name="reload"  classname="org.apache.catalina.ant.ReloadTask"/>
-  <taskdef name="remove"  classname="org.apache.catalina.ant.RemoveTask"/>
-
-
-<!--  ==================== Compilation Control Options ==================== -->
-
-<!--
-
-  These properties control option settings on the Javac compiler when it
-  is invoked using the <javac> task.
-
-  compile.debug        Should compilation include the debug option?
-
-  compile.deprecation  Should compilation include the deprecation option?
-
-  compile.optimize     Should compilation include the optimize option?
-
--->
-
-  <property name="compile.debug"       value="true"/>
-  <property name="compile.deprecation" value="false"/>
-  <property name="compile.optimize"    value="true"/>
-
-
-
-<!-- ==================== External Dependencies =========================== -->
-
-
-<!--
-
-  Use property values to define the locations of external JAR files on which
-  your application will depend.  In general, these values will be used for
-  two purposes:
-  * Inclusion on the classpath that is passed to the Javac compiler
-  * Being copied into the "/WEB-INF/lib" directory during execution
-    of the "deploy" target.
-
-  Because we will automatically include all of the Java classes that Tomcat 4
-  exposes to web applications, we will not need to explicitly list any of those
-  dependencies.  You only need to worry about external dependencies for JAR
-  files that you are going to include inside your "/WEB-INF/lib" directory.
-
--->
-
-<!-- Dummy external dependency -->
-<!--
-  <property name="foo.jar"
-           value="/path/to/foo.jar"/>
--->
-
-
-<!-- ==================== Compilation Classpath =========================== -->
-
-<!--
-
-  Rather than relying on the CLASSPATH environment variable, Ant includes
-  features that makes it easy to dynamically construct the classpath you
-  need for each compilation.  The example below constructs the compile
-  classpath to include the servlet.jar file, as well as the other components
-  that Tomcat makes available to web applications automatically, plus anything
-  that you explicitly added.
-
--->
-
-  <path id="compile.classpath">
-
-    <!-- Include all JAR files that will be included in /WEB-INF/lib -->
-    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
-<!--
-    <pathelement location="${foo.jar}"/>
--->
-
-    <!-- Include all elements that Tomcat exposes to applications -->
-    <pathelement location="${catalina.home}/common/classes"/>
-    <fileset dir="${catalina.home}/common/endorsed">
-      <include name="*.jar"/>
-    </fileset>
-    <fileset dir="${catalina.home}/common/lib">
-      <include name="*.jar"/>
-    </fileset>
-    <pathelement location="${catalina.home}/shared/classes"/>
-    <fileset dir="${catalina.home}/shared/lib">
-      <include name="*.jar"/>
-    </fileset>
-
-  </path>
-
-
-
-<!-- ==================== All Target ====================================== -->
-
-<!--
-
-  The "all" target is a shortcut for running the "clean" target followed
-  by the "compile" target, to force a complete recompile.
-
--->
-
-  <target name="all" depends="clean,compile"
-   description="Clean build and dist directories, then compile"/>
-
-
-
-<!-- ==================== Clean Target ==================================== -->
-
-<!--
-
-  The "clean" target deletes any previous "build" and "dist" directory,
-  so that you can be ensured the application can be built from scratch.
-
--->
-
-  <target name="clean"
-   description="Delete old build and dist directories">
-    <delete dir="${build.home}"/>
-    <delete dir="${dist.home}"/>
-  </target>
-
-
-
-<!-- ==================== Compile Target ================================== -->
-
-<!--
-
-  The "compile" target transforms source files (from your "src" directory)
-  into object files in the appropriate location in the build directory.
-  This example assumes that you will be including your classes in an
-  unpacked directory hierarchy under "/WEB-INF/classes".
-
--->
-
-  <target name="compile" depends="prepare"
-   description="Compile Java sources">
-
-    <!-- Compile Java classes as necessary -->
-    <mkdir    dir="${build.home}/WEB-INF/classes"/>
-    <javac srcdir="${src.home}"
-          destdir="${build.home}/WEB-INF/classes"
-            debug="${compile.debug}"
-      deprecation="${compile.deprecation}"
-         optimize="${compile.optimize}">
-        <classpath refid="compile.classpath"/>
-    </javac>
-
-    <!-- Copy application resources -->
-    <copy  todir="${build.home}/WEB-INF/classes">
-      <fileset dir="${src.home}" excludes="**/*.java"/>
-    </copy>
-
-  </target>
-
-
-
-<!-- ==================== Dist Target ===================================== -->
-
-
-<!--
-
-  The "dist" target creates a binary distribution of your application
-  in a directory structure ready to be archived in a tar.gz or zip file.
-  Note that this target depends on two others:
-
-  * "compile" so that the entire web application (including external
-    dependencies) will have been assembled
-
-  * "javadoc" so that the application Javadocs will have been created
-
--->
-
-  <target name="dist" depends="compile,javadoc"
-   description="Create binary distribution">
-
-    <!-- Copy documentation subdirectories -->
-    <mkdir   dir="${dist.home}/docs"/>
-    <copy    todir="${dist.home}/docs">
-      <fileset dir="${docs.home}"/>
-    </copy>
-
-    <!-- Create application JAR file -->
-    <jar jarfile="${dist.home}/${app.name}-${app.version}.war"
-         basedir="${build.home}"/>
-
-    <!-- Copy additional files to ${dist.home} as necessary -->
-
-  </target>
-
-
-
-<!-- ==================== Install Target ================================== -->
-
-<!--
-
-  The "install" target tells the specified Tomcat 4 installation to dynamically
-  install this web application and make it available for execution.  It does
-  *not* cause the existence of this web application to be remembered across
-  Tomcat restarts; if you restart the server, you will need to re-install all
-  this web application.
-
-  If you have already installed this application, and simply want Tomcat to
-  recognize that you have updated Java classes (or the web.xml file), use the
-  "reload" target instead.
-
-  NOTE:  This target will only succeed if it is run from the same server that
-  Tomcat is running on.
-
-  NOTE:  This is the logical opposite of the "remove" target.
-
--->
-
-  <target name="install" depends="compile"
-   description="Install application to servlet container">
-
-    <install url="${manager.url}"
-        username="${manager.username}"
-        password="${manager.password}"
-            path="${app.path}"
-             war="file://${build.home}"/>
-
-  </target>
-
-
-<!-- ==================== Javadoc Target ================================== -->
-
-<!--
-
-  The "javadoc" target creates Javadoc API documentation for the Java
-  classes included in your application.  Normally, this is only required
-  when preparing a distribution release, but is available as a separate
-  target in case the developer wants to create Javadocs independently.
-
--->
-
-  <target name="javadoc" depends="compile"
-   description="Create Javadoc API documentation">
-
-    <mkdir          dir="${dist.home}/docs/api"/>
-    <javadoc sourcepath="${src.home}"
-                destdir="${dist.home}/docs/api"
-           packagenames="*">
-      <classpath refid="compile.classpath"/>
-    </javadoc>
-
-  </target>
-
-
-
-<!-- ====================== List Target =================================== -->
-
-<!--
-
-  The "list" target asks the specified Tomcat 4 installation to list the
-  currently running web applications, either loaded at startup time or
-  installed dynamically.  It is useful to determine whether or not the
-  application you are currently developing has been installed.
-
--->
-
-  <target name="list"
-   description="List installed applications on servlet container">
-
-    <list    url="${manager.url}"
-        username="${manager.username}"
-        password="${manager.password}"/>
-
-  </target>
-
-
-<!-- ==================== Prepare Target ================================== -->
-
-<!--
-
-  The "prepare" target is used to create the "build" destination directory,
-  and copy the static contents of your web application to it.  If you need
-  to copy static files from external dependencies, you can customize the
-  contents of this task.
-
-  Normally, this task is executed indirectly when needed.
-
--->
-
-  <target name="prepare">
-
-    <!-- Create build directories as needed -->
-    <mkdir  dir="${build.home}"/>
-    <mkdir  dir="${build.home}/WEB-INF"/>
-    <mkdir  dir="${build.home}/WEB-INF/classes"/>
-
-
-    <!-- Copy static content of this web application -->
-    <copy todir="${build.home}">
-      <fileset dir="${web.home}"/>
-    </copy>
-
-    <!-- Copy external dependencies as required -->
-    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
-    <mkdir  dir="${build.home}/WEB-INF/lib"/>
-<!--
-    <copy todir="${build.home}/WEB-INF/lib" file="${foo.jar}"/>
--->
-
-    <!-- Copy static files from external dependencies as needed -->
-    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
-
-  </target>
-
-
-<!-- ==================== Reload Target =================================== -->
-
-<!--
-
-  The "reload" target tells the specified Tomcat 4 installation to dynamically
-  reload this web application, to reflect changes in the underlying classes or
-  the "web.xml" deployment descriptor.
-
--->
-
-  <target name="reload" depends="compile"
-   description="Reload application on servlet container">
-
-    <reload url="${manager.url}"
-       username="${manager.username}"
-       password="${manager.password}"
-           path="${app.path}"/>
-
-  </target>
-
-
-<!-- ==================== Remove Target =================================== -->
-
-<!--
-
-  The "remove" target tells the specified Tomcat 4 installation to dynamically
-  remove this web application from service.
-
-  NOTE:  This is the logical opposite of the "install" target.
-
--->
-
-  <target name="remove"
-   description="Remove application on servlet container">
-
-    <remove url="${manager.url}"
-       username="${manager.username}"
-       password="${manager.password}"
-           path="${app.path}"/>
-
-  </target>
-
-
-  <target name="help">
-    <echo>all      clean, them compile</echo>
-    <echo>dist     create war file</echo>
-    <echo>install  install application in servlet container</echo>
-    <echo>list     list applications installed in servelet container</echo>
-    <echo>reload   reload application in servlet container</echo>
-    <echo>remove   dynamically remove web application</echo>
-  </target>
-
-</project>
index c2759b0ea94b3ab8fdef0e4eb76d761dbf80edca..682b43bab5ac79596602576e8615e97f231b610c 100644 (file)
@@ -14,6 +14,19 @@ public abstract class Command {
      * @throws CommandFailedException if the command could not be completed.
      */
     public abstract String execute() throws CommandFailedException;
+    
+    /**
+     * Wraps execute() suitable for the web interface: all exceptions are
+     * converted into output strings.
+     * @return Output string, whether command succeeded or not.
+     */
+    public String executeWeb() {
+        try {
+            return execute();
+        } catch (CommandFailedException e) {
+            return e.getMessage();
+        }
+    }
 
     /**
      * Construct a string to report the execution of a command.
diff --git a/tools/control/src/org/xenoserver/web/RootBean.java b/tools/control/src/org/xenoserver/web/RootBean.java
new file mode 100644 (file)
index 0000000..cf65a8f
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * RootBean.java
+ * 03.05.05 aho creation
+ */
+
+package org.xenoserver.web;
+
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
+
+import org.xenoserver.control.PartitionManager;
+import org.xenoserver.control.Settings;
+import org.xenoserver.control.VirtualDiskManager;
+import org.xenoserver.control.XML;
+
+public class RootBean implements HttpSessionBindingListener {
+    static String state_filename_out = "/var/lib/xen/vdstate.xml";
+    static String partition_filename = "/proc/partitions";
+    static int default_sector_size = 512;
+
+    PartitionManager pm;
+    VirtualDiskManager vdm;
+
+    public RootBean() {
+        valueBound(null);
+    }
+
+    public void valueBound(HttpSessionBindingEvent event) {
+        pm = PartitionManager.IT;
+        vdm = VirtualDiskManager.IT;
+        XML.loadState(pm, vdm, Settings.STATE_INPUT_FILE);
+    }
+
+    public void valueUnbound(HttpSessionBindingEvent event) {
+        doFlushState();
+    }
+
+/*
+    public int getPartitionCount() {
+        return pm.getPartitionCount();
+    }
+
+    public Partition getPartition(int index) {
+        return pm.getPartition(index);
+    }
+
+    public String doAddPartition(String partition, String chunksize) {
+        Partition p = pm.get_partition(partition);
+        String result = "done";
+        int loop;
+        long size;
+
+        if (p == null) {
+            return (" eh? what partition: " + partition);
+        }
+
+        size = Library.parse_size(chunksize) / default_sector_size;
+        if (size == 0) {
+            return ("error: invalid chunk size");
+        }
+        vdm.add_xeno_partition(p, size);
+        pm.add_xeno_partition(p);
+
+        return "done";
+    }
+
+    public int getVirtualDiskCount() {
+        return vdm.getVirtualDiskCount();
+    }
+
+    public VirtualDisk getVirtualDisk(int index) {
+        return vdm.getVirtualDisk(index);
+    }
+
+    public VirtualDisk getVirtualDiskKey(String key) {
+        return vdm.get_virtual_disk_key(key);
+    }
+
+    public String doCreateVirtualDisk(String name, String size, long expiry) {
+        VirtualDisk vd;
+        Date date = new Date();
+        long parse_size;
+
+        parse_size = Library.parse_size(size) / default_sector_size;
+        if (parse_size == 0) {
+            return ("error: invalid size");
+        }
+        vd =
+            vdm.create_virtual_disk(
+                name,
+                parse_size,
+                new Date(date.getTime() + expiry));
+
+        return ("Virtual Disk created with key: " + vd.get_key());
+
+    }
+
+    public String doDeleteVirtualDisk(String key) {
+        if (key == null || key.trim().equals("")) {
+            return ("error: no virtual disk specified");
+        }
+        vdm.delete_virtual_disk(key);
+
+        return ("okay");
+    }
+
+    public String doRefreshVirtualDisk(String key, long expiry) {
+        VirtualDisk vd = vdm.get_virtual_disk_key(key);
+        Date date;
+        String s = "";
+
+        if (vd == null) {
+            return ("disk not found: " + key);
+        }
+        s = vd.get_expiry().toString();
+        date = new Date(vd.get_expiry().getTime() + expiry);
+        vd.set_expiry(date);
+
+        return ("okay " + expiry + " " + s + " " + date.toString());
+    }
+
+    public int getFreeExtentCount() {
+        VirtualDisk free = vdm.getFreeVirtualDisk();
+        return free.getExtentCount();
+    }
+
+    public Extent getFreeExtent(int index) {
+        VirtualDisk free = vdm.getFreeVirtualDisk();
+        return free.getExtent(index);
+    }
+
+    public Enumeration getVirtualBlockDevices() {
+        return vdm.getVirtualBlockDevices();
+    }
+
+    public String doCreateVirtualBlockDevice(
+        String vd_key,
+        int domain,
+        int vbd_num,
+        String mode) {
+        VirtualBlockDevice vbd;
+        VirtualDisk vd;
+
+        vbd = vdm.create_virtual_block_device(vd_key, domain, vbd_num, mode);
+        if (vbd != null) {
+            String command;
+            FileWriter fw;
+
+            vd = vdm.get_virtual_disk_key(vd_key);
+            command = vd.dump_xen(vbd);
+
+            try {
+                fw = new FileWriter("/proc/xeno/dom0/vhd");
+                fw.write(command);
+                fw.flush();
+                fw.close();
+            } catch (Exception e) {
+                return (e.toString());
+            }
+            return command;
+        } else {
+            return "Error encountered";
+        }
+    }
+
+    public String doFlushVirtualBlockDevices() {
+        vdm.flush_virtual_block_devices();
+        return "done";
+    }
+*/
+    public void doFlushState() {
+        XML.saveState(pm, vdm, Settings.STATE_OUTPUT_FILE);
+    }
+}
diff --git a/tools/control/src/org/xenoserver/web/SystemConfigurationBean.java b/tools/control/src/org/xenoserver/web/SystemConfigurationBean.java
new file mode 100644 (file)
index 0000000..1b67152
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * SystemConfigurationBean.java
+ * 03.05.06 aho creation
+ */
+
+package org.xenoserver.web;
+
+import org.xenoserver.control.Defaults;
+
+public class SystemConfigurationBean {
+    private Defaults defaults;
+
+    public SystemConfigurationBean() {
+        defaults = new Defaults();
+    }
+
+    public Defaults getDefaults() {
+        return defaults;
+    }
+}
diff --git a/tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/RootBean.java
deleted file mode 100644 (file)
index 668f922..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * RootBean.java
- * 03.05.05 aho creation
- */
-
-package uk.ac.cam.cl.xeno.xenctl;
-
-import java.io.FileWriter;
-import java.util.Date;
-import java.util.Enumeration;
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpSessionBindingListener;
-
-public class
-RootBean
-  implements HttpSessionBindingListener
-{
-  static String state_filename_in  = "/var/lib/xen/vdstate.xml";
-  static String state_filename_out = "/var/lib/xen/vdstate.xml";
-  static String partition_filename = "/proc/partitions";
-  static int    default_sector_size = 512;
-
-  PartitionManager pm;
-  VirtualDiskManager vdm;
-
-  int counter = 0;
-
-  public
-  RootBean ()
-  {
-    valueBound(null);
-  }
-
-  public void
-  valueBound (HttpSessionBindingEvent event)
-  {
-    pm = new PartitionManager(partition_filename);
-    vdm = new VirtualDiskManager();
-    XML.load_state(pm, vdm, state_filename_in);
-  }
-
-  public void
-  valueUnbound (HttpSessionBindingEvent event)
-  {
-    doFlushState();
-  }
-
-  public int
-  getDebugCounter()
-  {
-    return counter++;
-  }
-
-  /*************************************************************************/
-
-  public int
-  getPartitionCount()
-  {
-    return pm.getPartitionCount();
-  }
-
-  public Partition
-  getPartition(int index)
-  {
-    return pm.getPartition(index);
-  }
-
-  public String
-  doAddPartition(String partition, String chunksize )
-  {
-    Partition p = pm.get_partition(partition);
-    String result="done";
-    int loop;
-    long size;
-
-    if (p == null)
-    {
-      return (" eh? what partition: " + partition);
-    }
-
-    size = Library.parse_size(chunksize) / default_sector_size;
-    if (size == 0)
-    {
-      return ("error: invalid chunk size");
-    }
-    vdm.add_xeno_partition(p, size);
-    pm.add_xeno_partition(p);
-
-    /*    return pm.dump(true); */
-    return "done";
-  }
-
-  /*************************************************************************/
-
-  public int
-  getVirtualDiskCount ()
-  {
-    return vdm.getVirtualDiskCount();
-  }
-
-  public VirtualDisk
-  getVirtualDisk (int index)
-  {
-    return vdm.getVirtualDisk(index);
-  }
-
-  public VirtualDisk
-  getVirtualDiskKey (String key)
-  {
-    return vdm.get_virtual_disk_key(key);
-  }
-
-  public String
-  doCreateVirtualDisk (String name, String size, long expiry)
-  {
-    VirtualDisk vd;
-    Date date = new Date();
-    long parse_size;
-
-
-    parse_size = Library.parse_size(size)/default_sector_size;
-    if (parse_size == 0)
-    {
-      return ("error: invalid size");
-    }
-    vd = vdm.create_virtual_disk(name, parse_size,
-                                new Date(date.getTime() + expiry));
-
-    return ("Virtual Disk created with key: " + vd.get_key());
-
-  }
-
-  public String
-  doDeleteVirtualDisk (String key)
-  {
-    if (key == null ||
-       key.trim().equals(""))
-    {
-      return ("error: no virtual disk specified");
-    }
-    vdm.delete_virtual_disk(key);
-
-    return ("okay");
-  }
-
-  public String
-  doRefreshVirtualDisk (String key, long expiry)
-  {
-    VirtualDisk vd = vdm.get_virtual_disk_key(key);
-    Date date;
-    String s = "";
-
-    if (vd == null) 
-    {
-      return ("disk not found: " + key);
-    }
-    s = vd.get_expiry().toString();
-    date =  new Date(vd.get_expiry().getTime() + expiry);
-    vd.set_expiry(date);
-
-    return ("okay " + expiry + " " + s + " " + date.toString());
-  }
-
-  /*************************************************************************/
-
-  public int
-  getFreeExtentCount ()
-  {
-    VirtualDisk free = vdm.getFreeVirtualDisk();
-    return free.getExtentCount();
-  }
-
-  public Extent
-  getFreeExtent (int index)
-  {
-    VirtualDisk free = vdm.getFreeVirtualDisk();
-    return free.getExtent(index);
-  }
-
-  /*************************************************************************/
-
-  public Enumeration
-  getVirtualBlockDevices ()
-  {
-    return vdm.getVirtualBlockDevices();
-  }
-
-  public String
-  doCreateVirtualBlockDevice (String vd_key, int domain, 
-                             int vbd_num, String mode)
-  {
-    VirtualBlockDevice vbd;
-    VirtualDisk vd;
-
-    vbd = vdm.create_virtual_block_device(vd_key, domain, vbd_num, mode);
-    if (vbd != null)
-    {
-      String command;
-      FileWriter fw;
-
-      vd = vdm.get_virtual_disk_key(vd_key);
-      command = vd.dump_xen(vbd);
-
-      try
-      {
-       fw = new FileWriter("/proc/xeno/dom0/vhd");
-       fw.write(command);
-       fw.flush();
-       fw.close();
-      }
-      catch (Exception e)
-      {
-       return (e.toString());
-      }
-      return command;
-    }
-    else
-    {
-      return "Error encountered";
-    }
-  }
-
-  public String
-  doFlushVirtualBlockDevices()
-  {
-    vdm.flush_virtual_block_devices();
-    return "done";
-  }
-
-  /*************************************************************************/
-
-
-  public void
-  doFlushState ()
-  {
-    XML.dump_state(pm, vdm, state_filename_out);
-  }
-
-}
diff --git a/tools/control/src/uk/ac/cam/cl/xeno/xenctl/SystemConfigurationBean.java b/tools/control/src/uk/ac/cam/cl/xeno/xenctl/SystemConfigurationBean.java
deleted file mode 100644 (file)
index 7c2605d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SystemConfigurationBean.java
- * 03.05.06 aho creation
- */
-
-package uk.ac.cam.cl.xeno.xenctl;
-
-import java.io.*;
-import java.lang.Process;
-import java.lang.Runtime;
-import uk.ac.cam.cl.xeno.domctl.Defaults;
-
-public class
-SystemConfigurationBean
-{
-  Defaults defaults;
-
-  public
-  SystemConfigurationBean ()
-  {
-    defaults = new Defaults();
-  }
-
-  public Defaults
-  getDefaults ()
-  {
-    return defaults;
-  }
-
-}
index 1c71fba8366180edf94e9a0f70644b13ed54c5bc..b6a9810c4e3a4d445742c4765ee9e660cb17078e 100644 (file)
@@ -15,9 +15,15 @@ INCLUDE&dommenu.tmpl
 <tbody>
 <tr><td>
 <%
-  CommandList command_list = new CommandList();
-  Defaults d = sc.getDefaults(); 
-  Domain domains[] = command_list.executeCommand(d);
+  CommandDomainList list = new CommandDomainList(sc.getDefaults());
+  String output = list.executeWeb();
+  Domain domains[] = list.domains();
+  if (output != null)
+  {
+%>
+<%= output %>
+<%
+  } else {
 %>
 
 <table cellpadding="2" cellspacing="0" border="0">
@@ -45,6 +51,10 @@ INCLUDE&dommenu.tmpl
 </table>
 </td></tr>
 
+<%
+  }
+%>
+
 ##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
 
 <tr><td>
index 04218eb72be7bd8076ce7586d495120d1d7031e9..9dad9de69e9cdbd94c4400054b18d966a35cb531 100644 (file)
@@ -17,7 +17,6 @@ INCLUDE&dommenu.tmpl
 <%
   HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   Defaults d = sc.getDefaults(); 
-  CommandDestroy command_destroy = new CommandDestroy();
 
   String domains[] = hsrw.getParameterValues("dom");
   boolean force = hsrw.getParameter("force").equals("true");
@@ -34,8 +33,8 @@ Error: no domain specified.<br>
     {
 %>
 result <%= domains[i] %> =
- <%= command_destroy.executeCommand(d, Integer.parseInt(domains[i]),
-                                    force) %> <br>
+ <%= new CommandDomainDestroy(d, Integer.parseInt(domains[i]),
+                                    force).executeWeb() %> <br>
 <%
     }
   }
index 7a479a0f8702315678a7fc4d2c31ecf3f393f0c9..5ff61e1ab3140e764036ea908b7846e2ba9a8c47 100644 (file)
@@ -11,9 +11,15 @@ INCLUDE&dommenu.tmpl
 <td valign="top">
 
 <%
-  CommandList command_list = new CommandList();
-  Defaults d = sc.getDefaults(); 
-  Domain domains[] = command_list.executeCommand(d);
+  CommandDomainList list = new CommandDomainList(sc.getDefaults());
+  String output = list.executeWeb();
+  Domain domains[] = list.domains();
+  if (output != null)
+  {
+%>
+<%= output %>
+<%
+  } else {
 %>
 
 <table cellpadding="2" cellspacing="0" border="0">
@@ -38,7 +44,9 @@ INCLUDE&dommenu.tmpl
   %>
 </tbody>
 </table>
-
+<%
+  }
+%>
 
 </td>
 </tbody>
index b442b72537dee3d73808b66b35cb24246c803e84..6025225e1008daae20fec3f104544413d68aaff2 100644 (file)
@@ -95,19 +95,19 @@ INCLUDE&dommenu.tmpl
   <td></td> <td></td>
   <td class="block" align="right">IP address</td>
   <td></td>
-  <td> <input type="text" size="15" name="ip" value="<%= d.NWIP %>"> </td>
+  <td> <input type="text" size="15" name="ip" value="<%= d.nwIP %>"> </td>
 </tr>
 <tr>
   <td></td>   <td></td> 
   <td class="block" align="right">Gateway</td>
   <td></td>
-  <td> <input type="text" size="15" name="gw" value="<%= d.NWGW %>"> </td>
+  <td> <input type="text" size="15" name="gw" value="<%= d.nwGateway %>"> </td>
 </tr>
 <tr>
   <td></td>   <td></td> 
   <td class="block" align="right">Netmask</td>
   <td></td>
-  <td> <input type="text" size="15" name="mask" value="<%= d.NWMask %>"> </td>
+  <td> <input type="text" size="15" name="mask" value="<%= d.nwMask %>"> </td>
 </tr>
 
 ##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
@@ -121,11 +121,11 @@ INCLUDE&dommenu.tmpl
 
 <tr>
   <td></td>
-  <td align="right">NFS<input type="radio" name="root" value="nfs"></td>
+  <td align="right">NFS<input type="radio" checked name="root" value="nfs"></td>
   <td align="right">path</td>
   <td></td>
   <td>
-    <input type="text" size="40" name="nfsroot" value="<%= d.NWNFSRoot %>">
+    <input type="text" size="40" name="nfsroot" value="<%= d.nwNFSRoot %>">
   </td>
 </tr>
 <tr>
@@ -133,7 +133,7 @@ INCLUDE&dommenu.tmpl
   <td align="right">server</td>
   <td></td>
   <td>
-    <input type="text" size="15" name="nfsserver" value="<%= d.NWNFSServer%>">
+    <input type="text" size="15" name="nfsserver" value="<%= d.nwNFSServer%>">
   </td>
 </tr>
  ##WHITESPACE##
@@ -143,13 +143,13 @@ INCLUDE&dommenu.tmpl
   <td align="right">path</td>
   <td></td>
   <td>
-    <input type="text" size="40" name="rd" value="/usr/isolinux/initrd.gz">
+    <input type="text" size="40" name="rd" value="<%= d.domainInitRD %>">
   </td>
 </tr>
  ##WHITESPACE##
 <tr>
   <td></td>
-  <td align="right">physical disk<input type="radio" checked name="root" value="pdisk"></td>
+  <td align="right">physical disk<input type="radio" name="root" value="pdisk"></td>
   <td align="right">path</td>
   <td></td>
   <td><input type="text" size="40" name="pdisk" value="/dev/sda8"></td>
@@ -172,7 +172,7 @@ INCLUDE&dommenu.tmpl
   <td></td> 
   <td colspan=2 align="right"></td>
   <td></td>
-  <td> <input type="text" size="40" name="args" value="ro"> </td>
+  <td> <input type="text" size="40" name="args" value="<%= d.args %>"> </td>
 </tr>
 
 
index 2800eac70252a30514da6e5fbcd7316ae9e536d2..f762d3269a7d8b0c5488b9bb27f45e99bb2584cc 100644 (file)
@@ -16,7 +16,6 @@ INCLUDE&dommenu.tmpl
 <%
   HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   Defaults d = sc.getDefaults(); 
-  CommandNew command_new = new CommandNew();
   String root_device = hsrw.getParameter("root");
 
   String nfsroot = null;
@@ -73,8 +72,9 @@ nw_host = <%= hsrw.getParameter("hostname") %>
 <br>
 root = <%= disk %>
 <br>
-output = <br><%=
-  command_new.executeCommand(d,
+output = <br>
+<%
+  CommandDomainNew command_new = new CommandDomainNew(d,
                              hsrw.getParameter("name"),
                              Integer.parseInt(hsrw.getParameter("size")),
                              hsrw.getParameter("image"),
@@ -87,7 +87,20 @@ output = <br><%=
                              hsrw.getParameter("gw"),
                              hsrw.getParameter("mask"),
                              nfsserver,
-                             hsrw.getParameter("hostname"))
+                             hsrw.getParameter("hostname"));
+  String oneline = command_new.executeWeb();
+  if ( oneline != null ) {
+%>
+<%= oneline %><br>
+<%
+  } else {
+    String[] output = command_new.output();
+    for (int i = 0; i < output.length; i++) {
+%>
+<%= output[i] %><br>
+<%
+    }
+  }
 %>
 
 </td>
index 06fda1a96ad79d3eb6e9d5a18a47794309bc05ef..48fa3ca3be31395e63d7caa57746cf70abad0d57 100644 (file)
@@ -15,9 +15,15 @@ INCLUDE&dommenu.tmpl
 <tbody>
 <tr><td>
 <%
-  CommandList command_list = new CommandList();
-  Defaults d = sc.getDefaults(); 
-  Domain domains[] = command_list.executeCommand(d);
+  CommandDomainList list = new CommandDomainList(sc.getDefaults());
+  String output = list.executeWeb();
+  Domain domains[] = list.domains();
+  if (output != null)
+  {
+%>
+<%= output %>
+<%
+  } else {
 %>
 
 <table cellpadding="2" cellspacing="0" border="0">
@@ -44,6 +50,9 @@ INCLUDE&dommenu.tmpl
 </tbody>
 </table>
 </td></tr>
+<%
+  }
+%>
 
 ##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
 
index 2c3b56ef3decab4dd7256469118b41431316de10..b9110cfca8f877b6cec0fedd77f3ea634f7ea5cb 100644 (file)
@@ -17,7 +17,6 @@ INCLUDE&dommenu.tmpl
 <%
   HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   Defaults d = sc.getDefaults(); 
-  CommandStart command_start = new CommandStart();
 
   String domains[] = hsrw.getParameterValues("dom");
 
@@ -32,8 +31,8 @@ Error: no domain specified.<br>
     for (int i = 0; i < domains.length; i++)
     {
 %>
-result <%= domains[i] %> =<br>
-<%= command_start.executeCommand(d, Integer.parseInt(domains[i])) %> <br>
+result <%= domains[i] %> =
+<%= new CommandDomainStart(d, Integer.parseInt(domains[i])).executeWeb() %><br>
 <%
     }
   }
index 8587a5a5946ffeafbb082e56d2ce29b4b4037c5a..6e9b34989c27de89c0958fbcbd388eede7f5f1d2 100644 (file)
@@ -15,9 +15,15 @@ INCLUDE&dommenu.tmpl
 <tbody>
 <tr><td>
 <%
-  CommandList command_list = new CommandList();
-  Defaults d = sc.getDefaults(); 
-  Domain domains[] = command_list.executeCommand(d);
+  CommandDomainList list = new CommandDomainList(sc.getDefaults());
+  String output = list.executeWeb();
+  Domain domains[] = list.domains();
+  if (output != null)
+  {
+%>
+<%= output %>
+<%
+  } else {
 %>
 
 <table cellpadding="2" cellspacing="0" border="0">
@@ -44,6 +50,9 @@ INCLUDE&dommenu.tmpl
 </tbody>
 </table>
 </td></tr>
+<%
+  }
+%>
 
 ##WHITESPACE## ##GREYLINE1## ##WHITESPACE##
 
index a2eb6b23a615a6ae7ea5ca69e3289e22e9b32b63..148afb83a10e1c8ec29401cb2c76995e0837cf6c 100644 (file)
@@ -17,7 +17,6 @@ INCLUDE&dommenu.tmpl
 <%
   HttpServletRequestWrapper hsrw = new HttpServletRequestWrapper(request);
   Defaults d = sc.getDefaults(); 
-  CommandStop command_stop = new CommandStop();
 
   String domains[] = hsrw.getParameterValues("dom");
 
@@ -33,7 +32,7 @@ Error: no domain specified.<br>
     {
 %>
 result <%= domains[i] %> =
- <%= command_stop.executeCommand(d, Integer.parseInt(domains[i])) %> <br>
+<%= new CommandDomainStop(d, Integer.parseInt(domains[i])).executeWeb() %><br>
 <%
     }
   }
index 6e602c979fbf8c5351c17aa55a06e8811a80a20f..f107cd5e10a63db7d305f96ea66635f3a1428e41 100644 (file)
@@ -16,7 +16,7 @@ INCLUDE&dommenu.tmpl
   <tr><td nowrap="nowrap">Domain Manager</td></tr>
   <tr><td></td></tr>
 <!--
-  <tr><td><%= d.XIToolsDir %></td></tr>
+  <tr><td><%= d.xiToolsDir %></td></tr>
 -->
 </tbody>
 </table>
index a9e2a1c392c2f811c606b95279c5f92c9501373c..9e8ee2eca0aaa6a1a5422f809352ba82cd32ed25 100644 (file)
@@ -1,5 +1,5 @@
 src0 = xenostyle.css
-src1 = index.jsp newdom.jsp about.jsp help.jsp vd.jsp \
+src1 = index.jsp about.jsp help.jsp vd.jsp \
        vd-pv.jsp vd-pa.jsp vd-vdv.jsp vd-vdc.jsp vd-vdd.jsp vd-vdr.jsp \
        vd-fv.jsp vd-vbdv.jsp vd-vbdc.jsp vd-vbdd.jsp vd-vbdf.jsp \
        vd-par.jsp vd-vdcr.jsp vd-vddr.jsp vd-vdrr.jsp \
@@ -7,7 +7,8 @@ src1 = index.jsp newdom.jsp about.jsp help.jsp vd.jsp \
        dom.jsp dom-lis.jsp dom-new.jsp dom-newr.jsp dom-sta.jsp dom-star.jsp \
        dom-stp.jsp dom-stpr.jsp dom-del.jsp dom-delr.jsp
 target = ..
-target1 = $(target)/index.jsp $(target)/newdom.jsp $(target)/vd.jsp \
+target0 = $(target)/xenostyle.css
+target1 = $(target)/index.jsp $(target)/vd.jsp \
           $(target)/vd-pv.jsp $(target)/vd-pa.jsp $(target)/vd-vdv.jsp \
           $(target)/vd-vdc.jsp $(target)/vd-vdd.jsp $(target)/vd-vdr.jsp \
           $(target)/vd-fv.jsp $(target)/vd-vbdv.jsp $(target)/vd-vbdc.jsp \
@@ -22,14 +23,18 @@ target1 = $(target)/index.jsp $(target)/newdom.jsp $(target)/vd.jsp \
 
 .SUFFIXES: .tmpl .jsp
 
-.tmpl.jsp:
-       ./install.pl $*
+all: $(target1) $(target0)
 
-all: $(src0) $(src1)
+$(target)/index.jsp: index.tmpl
        ./install.pl -s -home index
-       mv *.jsp  $(target)
+       mv index.jsp $(target)
+
+$(target)/%.jsp: %.tmpl
+       ./install.pl $*
+       mv $*.jsp $(target)
+       
+$(target0): $(src0)
        cp -f $(src0) $(target)
 
 clean:
-       rm -f $(target1)
-       rm -f $(target)/$(src0)
+       rm -f $(target1) $(target0)
diff --git a/tools/control/web/tmpl/newdom.tmpl b/tools/control/web/tmpl/newdom.tmpl
deleted file mode 100644 (file)
index 47af39f..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-New Domain
-SECTION&XenoServers
-
-<!-- content -->
-<img src="pixel.gif" class="block" width="1" height="12">
-
-<form>
-<table cellpadding="0" cellspacing="0" border="0">
-<tbody>
-<tr>
-  <td width="50"></td>
-  <td></td>
-  <td></td>
-  <td width="7"></td>
-  <td></td>
-</tr>
-
-<tr>
-  <td></td>
-  <td class="block" colspan=4><b>Create A New Domain</b></td>
-</tr>
-
-##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
-
-<tr>
-  <td></td>
-  <td class="block" colspan=4>Memory Size</td>
-</tr>
-<tr>
-  <td></td>  <td></td>  <td></td>  <td></td>
-  <td> <input type="text" size="5" value="64"> MB </td>
-</tr>
-
-##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
-
-<tr>
-  <td></td>
-  <td class="block" colspan=4>Kernel Image</td>
-</tr>
-<tr>
-  <td></td> 
-  <td colspan=2 align="right">path</td>
-  <td></td>
-  <td> <input type="text" size="40" value="/usr/src/xeno/install/xenolinux.gz"> </td>
-</tr>
-
-##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
-
-<tr>
-  <td></td>
-  <td class="block" colspan=4>IP Config</td>
-</tr>
-<tr>
-  <td></td> <td></td>
-  <td class="block" align="right">IP address</td>
-  <td></td>
-  <td> <input type="text" size="15" value="128.232.35.202"> </td>
-</tr>
-<tr>
-  <td></td>   <td></td> 
-  <td class="block" align="right">Gateway</td>
-  <td></td>
-  <td> <input type="text" size="15" value="128.232.32.1"> </td>
-</tr>
-<tr>
-  <td></td>   <td></td> 
-  <td class="block" align="right">Netmask</td>
-  <td></td>
-  <td> <input type="text" size="15" value="255.255.240.0"> </td>
-</tr>
-<tr>
-  <td></td>   <td></td> 
-  <td class="block" align="right">New Name</td>
-  <td></td>
-  <td> <input type="text" size="15"> </td>
-</tr>
-
-##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
-
-<tr>
-  <td></td>
-  <td class="block" colspan=2>Root File System</td>
-</tr>
-
-##WHITESPACE##
-
-<tr>
-  <td></td>
-  <td align="right">NFS<input type="radio" name="root" value="nfs"></td>
-  <td align="right">path</td>
-  <td></td>
-  <td><input type="text" size="40" value="/usr/groups/xeno/srgboot/mousetrap/root0"></td>
-</tr>
-<tr>
-  <td></td>  <td></td>
-  <td align="right">server</td>
-  <td></td>
-  <td><input type="text" size="15" value="128.232.32.20"></td>
-</tr>
- ##WHITESPACE##
-<tr>
-  <td></td>
-  <td align="right">ramdisk<input type="radio" name="root" value="ram"></td>
-  <td align="right">path</td>
-  <td></td>
-  <td><input type="text" size="40" value="/usr/isolinux/initrd.gz"></td>
-</tr>
- ##WHITESPACE##
-<tr>
-  <td></td>
-  <td align="right">raw partition<input type="radio" name="root" value="raw"></td>
-  <td align="right">path</td>
-  <td></td>
-  <td><input type="text" size="40" value="/dev/xsda8"></td>
-</tr>
- ##WHITESPACE##
-<tr>
-  <td></td>
-  <td align="right">virtual disk<input type="radio" checked name="root" value="virtual"></td>
-  <td align="right">path</td>
-  <td></td>
-  <td><input type="text" size="40" value="/dev/xvda0"></td>
-</tr>
-
-##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
-
-<tr>
-  <td></td>
-  <td class="block" colspan=4>Extra Arguments</td>
-</tr>
-<tr>
-  <td></td> 
-  <td colspan=2 align="right"></td>
-  <td></td>
-  <td> <input type="text" size="40"> </td>
-</tr>
-
-
-##WHITESPACE## ##GREYLINE14## ##WHITESPACE##
-
-<tr>
-  <td></td>
-  <td><input type="submit" value="refresh"></td>
-</tr>
-
-##WHITESPACE## 
-
-<tr>
-  <td></td>
-  <td colspan=4>
-  <textarea cols="60" rows="5" name="commandline">
-When you press refresh, the sample command line shows
-up here. The user has the option of editing it before
-pressing execute below.  e.g.
-./newdom 16000 image 128.232.35.202 ip=128.232.35.202:128.232.32.20:128.232.32.1:255.255.240.0::eth0:off root=/dev/xsda9 ro
-</textarea>
-</td></tr>
-
-##WHITESPACE## 
-
-<tr>
-  <td></td>
-  <td><input type="submit" value="execute"></td>
-</tr>
-
-</tbody>
-</table>
-</form>
-
-
-
-<!-- end content -->
index 843244a0aeb53b880dae5d2c4762048f44094b68..5b0934a0510ee5d6d52078f804abcadd6f9095e3 100644 (file)
@@ -1,13 +1,13 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
 <jsp:useBean id="root" scope="application"
-             class="uk.ac.cam.cl.xeno.xenctl.RootBean" />
+             class="org.xenoserver.web.RootBean" />
 <jsp:useBean id="sc" scope="application"
-             class="uk.ac.cam.cl.xeno.xenctl.SystemConfigurationBean" />
+             class="org.xenoserver.web.SystemConfigurationBean" />
 <%@ page session="false" %>
-<%@ page import="uk.ac.cam.cl.xeno.xenctl.*" %>
-<%@ page import="uk.ac.cam.cl.xeno.domctl.*" %>
-<%@ page import="java.util.Enumeration" %>
+<%@ page import="org.xenoserver.web.*" %>
+<%@ page import="org.xenoserver.control.*" %>
+<%@ page import="java.util.Iterator" %>
 <%@ page import="javax.servlet.http.HttpServletRequestWrapper" %>
 
 <html lang="en">
@@ -20,7 +20,7 @@
 
 <head>
 
-<title>##SECTION## ##SECTIONBREAK## ##TITLE## <%= root.getDebugCounter() %></title>
+<title>##SECTION## ##SECTIONBREAK## ##TITLE##</title>
 
 <link rel="stylesheet" type="text/css" href="xenostyle.css">